package com.niiwoo.civet.trade.enums;

import com.niiwoo.tripod.provider.exception.NoSuchEnumValueException;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 退回标的原因类型
 */
@Getter
@AllArgsConstructor
public enum ReturnProjectReasonTypeEnum {

    ADDRESS_LIST_FAIL((byte) 0, "通讯录回流失败"),
    IDENTITY_REAL_INFO_FAIL((byte) 1, "实名信息回流失败"),
    LOAN_INFO_FAIL((byte) 2, "借款信息回流失败"),
    PERSONAL_INFO_FAIL((byte) 3, "个人基本信息回流失败"),
    PROFESSION_INFO_FAIL((byte) 4, "职业信息回流失败"),
    BANK_INFO_FAIL((byte) 5, "银行卡信息回流失败"),
    OPERATOR_AUTH_FAIL((byte) 6, "运营商数据获取失败"),
    SOCIAL_SECURITY_FAIL((byte) 7, "社保数据获取失败"),
    CREDIT_CARD_FAIL((byte) 8, "信用卡获取失败"),
    OTHER_EXCEPTION((byte) 9, "其他异常"),
    TAOBAO_FAIL((byte) 10, "淘宝信息获取失败");

    private Byte type;
    private String desc;

    public static ReturnProjectReasonTypeEnum enumOf(Byte type) {
        for (ReturnProjectReasonTypeEnum typeEnum : values()) {
            if (typeEnum.type.equals(type)) {
                return typeEnum;
            }
        }
        throw new NoSuchEnumValueException("ReturnProjectReasonTypeEnum:" + type);
    }

    public static String getDesc(Byte type) {
        for (ReturnProjectReasonTypeEnum typeEnum : values()) {
            if (typeEnum.type.equals(type)) {
                return typeEnum.getDesc();
            }
        }
        return null;
    }
}
